from django.conf import settings
from django.conf.urls import url
from django.urls import path, include
from django.views.static import serve
from rest_framework.routers import DefaultRouter

from apps.common.account.views import UserInfoView, AccountViewSet, RoleViewSet, PermissionViewSet, \
    LoginView
from apps.common.school.views import FacultyViewSet, MajorViewSet, ClassesViewSet
from apps.survey_system.file.views import UploadViewSet
from apps.survey_system.index.views import IndexViewSet
from apps.survey_system.question.views import QuestionCategoryViewSet, ModuleViewSet, QuestionViewSet, \
    QuestionnaireViewSet, SwiperViewSet, ModuleTeamViewSet
from apps.survey_system.survey.views import SurveyViewSet, SurveyAccountViewSet, SurveyAnswerViewSet, \
    SurveyAnalysisResultsViewSet

router = DefaultRouter()

# 首页相关
router.register('index', IndexViewSet, basename='index')

# 账号account 相关的url
router.register('account', AccountViewSet, basename='account')
router.register('role', RoleViewSet, basename='role')
router.register('permission', PermissionViewSet, basename='permission')

# 学校基本信息的
router.register('faculty', FacultyViewSet, basename='faculty')
router.register('major', MajorViewSet, basename='major')
router.register('classes', ClassesViewSet, basename='classes')
router.register('account', AccountViewSet, basename='account')

router.register('file', UploadViewSet, basename='file')
router.register('module', ModuleViewSet, basename='module')
router.register('module_team', ModuleTeamViewSet, basename='module_team')
router.register('question_category', QuestionCategoryViewSet, basename='question_category')
router.register('question', QuestionViewSet, basename='question')
router.register('questionnaire', QuestionnaireViewSet, basename='questionnaire')
router.register('survey', SurveyViewSet, basename='survey')
router.register('survey_account', SurveyAccountViewSet, basename='survey_account')
router.register('survey_answer', SurveyAnswerViewSet, basename='survey_answer')
router.register('survey_analysis_result', SurveyAnalysisResultsViewSet, basename='survey_analysis_result')

# 小程序首页轮播图
router.register('swiper', SwiperViewSet, basename='swiper')

urlpatterns = [
    path('login', LoginView.as_view()),
    path('user/info', UserInfoView.as_view()),
    path('api/', include(router.urls)),
    path('mini_program/', include('config.urls.survey.mini_program_urls'))
]
